Component({
  mixins: [],
  data: {
    checkedIndex: '',
    id:'',
  },
  props: {
    showPopup: false,
    popupTitle: '',
    list: [],
    content:'',
  },
  didMount() {
  },
  didUpdate() { },
  didUnmount() { },
  methods: {
    handleInput(e) {
      this.setData({
        content: e.detail.value
      })
    },
    setCheck(e) {
      const index = e.currentTarget.dataset.index;
      const { list } = this.props;
      list.forEach((element, idx) => {
        if (idx == index) {
          element.checked = true;
        } else {
          element.checked = false;
        }
      });
      this.setData({
        list,
        checkedIndex: index,
        id:list[index].value
      });
    },
    onPopupClose() {
      this.props.onClosePicker();
    },
    radioChange(e) {
      this.setData({
        checkedIndex: e.detail.value
      })
    },
    submit() {
      let namedesc='';
      if(this.data.checkedIndex==6){
        if(!this.data.content){
          my.alert({
            content: '取消原因必填',
            buttonText: '我知道了'
          })
          return;
        }
         namedesc=this.data.list[this.data.checkedIndex].name+this.data.content;
      }else{
        namedesc=this.data.list[this.data.checkedIndex].name;
      }
      this.props.onSetValue(namedesc);
    }
  },
});
